package com.neulogistics.contrib.transfercenter.domain.model.aggregate;


import com.neulogistics.contrib.transfercenter.domain.model.enumeration.TransferOrderStatus;
import com.neulogistics.contrib.transfercenter.domain.model.enumeration.TransferType;
import com.neulogistics.contrib.transfercenter.domain.model.valueobject.OrderItem;
import com.neulogistics.infrastructure.ddd.domain.seedwork.Entity;
import com.neulogistics.infrastructure.ddd.domain.seedwork.IAggregateRoot;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class TransferOrder extends Entity<Long> implements IAggregateRoot {
    /**
     * 调拨单id
     */
    private Long transferOrderId;

    /**
     * 调度类型：1:配送；2:退货；3:换货
     */
    private TransferType transferType;

    /**
     * 调度单状态：0:待调度：1:已调度；2:挂起
     */
    private TransferOrderStatus transferStatus;

    /**
     * 订单id
     */
    private Long orderId;

    /**
     * 关联任务单id
     */
    private Long taskId;

    /**
     * 出库库房id
     */
    private Integer outboundWarehouseId;

    /**
     * 入库库房id
     */
    private Integer inboundWarehouseId;

    /**
     * 订单项 [{商品id、名称、数量、单价、计量单位}]
     */
    private List<OrderItem> orderItems;

    /**
     * 计划出库时间
     */
    private Date expOutboundTime;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建人id
     */
    private Integer creatorId;

    /**
     * 是否删除
     */
    private Integer deleted;

    public TransferOrder(){}

    public TransferOrder(Long transferOrderId, TransferType transferType,
                         Long orderId, Integer outboundWarehouseId,
                         Integer inboundWarehouseId,
                         List<OrderItem> orderItems, Date expOutboundTime) {
        this.transferOrderId = transferOrderId;
        this.transferType = transferType;
        this.transferStatus = TransferOrderStatus.To_Be_Scheduled;
        this.orderId = orderId;
        this.outboundWarehouseId = outboundWarehouseId;
        this.inboundWarehouseId = inboundWarehouseId;
        this.orderItems = orderItems;
        this.expOutboundTime = expOutboundTime;
    }
}
